package com.qishao.controller;


import com.qishao.model.EduSubject;
import com.qishao.service.EduSubjectService;
import com.qishao.service_base.reponse.Response;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * <p>
 * 课程科目 前端控制器
 * </p>
 *
 * @author xushaoqi
 * @since 2021-11-02
 */
@Api(description = "课程分类管理")
@RestController
@RequestMapping("/eduService/edu-subject")
@CrossOrigin
public class EduSubjectController {

    @Autowired
    private EduSubjectService subjectService;

    @ApiOperation("Execl课程分类批量导入")
    @PostMapping("/batchExeclSubject")
    public Response batchExeclSubject(MultipartFile file){
        subjectService.batchExeclSubject(file,subjectService);
        return Response.ok();
    }


    @ApiOperation("查询课程分类列表")
    @PostMapping("/subjectList")
    public Response subjectList(){
        List<EduSubject> eduSubjects = subjectService.subjectList();
        return Response.ok().data("subjectList",eduSubjects);
    }


}

